package com.ossean.match.dao;

import java.util.List;

import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

public interface ResultDao {
	@Insert("insert into matched_result(proj_id,projName,tag_id,tagName,match_weight)values(#{prjId},#{prjName},#{tagId},#{tagName},#{score})")
	public void insertResult(@Param("prjId")int prjId, @Param("prjName")String string, @Param("tagId")int tagId, @Param("tagName")String tagOriginalName, @Param("score")float score);
	
	@Insert("insert into match_result_1(proj_id,projName,tag_id,tagName,match_weight)values(#{prjId},#{prjName},#{tagId},#{tagName},#{score})")
	public void insertResult1(@Param("prjId")int prjId, @Param("prjName")String string, @Param("tagId")int tagId, @Param("tagName")String tagOriginalName, @Param("score")float score);
	
	@Insert("insert into match_result_2(proj_id,projName,tag_id,tagName,match_weight)values(#{prjId},#{prjName},#{tagId},#{tagName},#{score})")
	public void insertResult2(@Param("prjId")int prjId, @Param("prjName")String string, @Param("tagId")int tagId, @Param("tagName")String tagOriginalName, @Param("score")float score);

	@Insert("insert into match_result_3(proj_id,projName,tag_id,tagName,match_weight)values(#{prjId},#{prjName},#{tagId},#{tagName},#{score})")
	public void insertResult3(@Param("prjId")int prjId, @Param("prjName")String string, @Param("tagId")int tagId, @Param("tagName")String tagOriginalName, @Param("score")float score);
	
	@Select("select proj_id from match_result_3 where tag_id = #{tagId}")
	public List<Integer> getMatchPrjId(@Param("tagId")int tagId);
	
	@Select("select tagName from match_result_3 where proj_id = #{projId}")
	public List<String> getMatchTag(@Param("projId")int projId);
	
	@Update("update open_source_projects set rank = #{rank}, rank_star = #{rank_star} where id = #{id} ")
	public void updateRank(@Param("rank")int rank, @Param("rank_star") double rank_star, @Param("id") int id);
}
